#pragma once
#ifndef HEADER_EMPLOYEE
#define HEADER_EMPLOYEE
#include<iostream>
#include<opencv4/opencv2/opencv.hpp>
#include<time.h>
using namespace std;
using namespace cv;

//enum the job
enum job {non,manager,engineer,salesman,desginer};
class System;

//Employee class
class Employee
{
protected:
    string name;
    string sex;
    int age;
    int basic_salary;
    int id;
    int job_salary;
    int subsidy;
    int insurance;
    string face;
public:
    Employee(){};
   // Employee(string n,char s,int a,int bs,int id):name(n),sex(s),age(a),basic_salary(bs),id(id){};
    virtual void print() = 0;
    virtual void countSalary(int& total,int& avg) = 0;
    virtual int getJob() = 0;
    void create();
    string getName();
    void write(cv::FileStorage& fs) const;
    void read(const cv::FileNode& node);
    friend ostream& operator<<(ostream& ,Employee&);
};


class Manager : public Employee
{
private:
//    static int manager_cnt;
public:
    Manager(){
        cv::RNG rng;
        face = "/home/zcf/公共的/keshe/images/manager"+to_string(rng.uniform(0,6))+".png";
        job_salary = 500;
        //manager_cnt++;
    }
    ~Manager()
    {
        //manager_cnt--;
    }
    virtual void print();
    virtual void countSalary(int& total,int& avg);
    virtual int getJob(){return manager;}
};



class Engineer : public Employee
{
private:
    //static int engineer_cnt;
public:
    Engineer()
    {
        cv::RNG rng;
        face = "/home/zcf/公共的/keshe/images/engineer"+to_string(rng.uniform(0,5))+".png";
        job_salary = 300;
        //engineer_cnt++;
    }
    ~Engineer()
    {
        //engineer_cnt--;
    }  
    virtual void print();
    virtual void countSalary(int& toatl,int& avg);
    virtual int getJob(){return engineer;}
};



class Salesman : public Employee
{
private:
    //static int salesman_cnt;
public:
    Salesman(){
        cv::RNG rng;
        face = "/home/zcf/公共的/keshe/images/salesman"+to_string(rng.uniform(0,5))+".png";
        job_salary = 100;
        //salesman_cnt++;
    }
    ~Salesman()
    {
        //salesman_cnt--;
        //cout<<"Manager destructor"<<endl;
    }
    virtual void print();
    virtual void countSalary(int& total,int& avg);
    virtual int getJob(){return salesman;}
};


class Desginer : public Employee
{
private:
    //static int desginer_cnt;
public:
    Desginer(){
        cv::RNG rng;
        face = "/home/zcf/公共的/keshe/images/desginer"+to_string(rng.uniform(0,5))+".png";
        job_salary = 200;
        //desginer_cnt++;
    }
    ~Desginer()
    {
        //desginer_cnt--;
    }
    virtual void print();
    virtual void countSalary(int &total,int& avg);
    virtual int getJob(){return desginer;}
};


#endif